package org.p2psimulator.factory.idfactory;

import org.p2psimulator.entity.Id;
import org.p2psimulator.entity.id.DoubleId;

public class PeerIdFactory extends IdFactory{


	public PeerIdFactory(int space) {
		super(space);
	}

	static double cnt = 0;

	@Override
	public synchronized Id<Double> generate() {

		Double total = Math.pow(2, space);
		Double i = (cnt)% total;
		cnt++;
		Id<Double> id = new DoubleId(i);
		return id;
	}
}
